package www.rlicker.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import www.rlicker.dao.IUserNotepadDao;
import www.rlicker.model.UserNotepad;
import www.rlicker.mybatis.Criteria;
import www.rlicker.service.IUserNotepadService;
import www.rlicker.utils.MessageConstant;
import www.rlicker.utils.TranslateToMap;

@Service
public class UserNotepadServiceImpl implements IUserNotepadService{

	public List<Map<String, Object>>  queryPage (Criteria<UserNotepad> param){
		List<UserNotepad> list = userNotepadRepository.queryPage(param);
		List<Map<String,Object>> map = TranslateToMap.convertListBean2ListMap(list,UserNotepad.class);
	return map;  }

	public Integer queryPageCount (Criteria<UserNotepad> param){
		return (Integer) userNotepadRepository.queryPageCount(param);
	}

	public UserNotepad  queryEntity (Integer id ){
		return userNotepadRepository.queryEntity(id);
	}

	public String deleteById (Integer id ){
		int result = userNotepadRepository.deleteById(id);
			if ( result != 1) {
					return MessageConstant.USER_TYPE_3;
			}
			return null;
	}

	public String insert(UserNotepad record ){
		int result = userNotepadRepository.insert(record);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_4;
			}
			return null;
	}

	public String update (Criteria<UserNotepad> param){
		int result = userNotepadRepository.update(param);
			if ( result != 1) { 
					return MessageConstant.USER_TYPE_5;
			}
			return null;
	}

	@Resource
	private IUserNotepadDao userNotepadRepository;

}